home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 94 / CD-ROM 94.iso / util / weban / setup.msi / Cabs.w23.cab / dropdown.js < prev    next >
Encoding:
Text File  |  2002-05-21  |  16.8 KB  |  708 lines

  1.  
  2. var comboBoxArray = new Array();
  3. var IPcomboBoxArray = new Array();
  4. var SUScomboBoxArray = new Array();
  5.  
  6. function CreateComboBoxObject(strDropDownListID, strComboBoxName)
  7. {
  8.     this.Mycmb = document.all[strDropDownListID];
  9.     this.SetDefaultText                = SetDefaultText;
  10.     this.Mycmb.selectedIndex        = -1;
  11.     this.UseStateFunctions            = false;
  12.     this.Clear                        = Clear;
  13.     this.GetSelectedText            = GetSelectedText;
  14.     this.AlignTextBoxOverDropDown    = AlignTextBoxOverDropDown;
  15.     this.cbo_OnChange                = cbo_OnChange;
  16.     this.txt_OnBlur                    = txt_OnBlur; 
  17.     this.setDefaultIndex            = setDefaultIndex;
  18.     this.txt_OnKeyUp                = txt_OnKeyUp;
  19.     this.focus                        = focus;
  20.     //do lookup or not
  21.     this.LookupValues                = true;
  22.     this.SetAccessKey                = SetAccessKey;
  23.     //case sensitivity
  24.     this.LookupCaseInSensitive    = true;
  25.     //store the previous text for the lookup
  26.     this.MytxtPreviousValue            = "";
  27.     //generate the text box on the fly
  28.     
  29.     var strMytxtID = "txtMytxt" + strDropDownListID;
  30.  
  31.     var strMytxt = "<INPUT type='text' id=" + strMytxtID + " name=" + strMytxtID + " onblur='" + strComboBoxName + ".txt_OnBlur()' " + 
  32.                        " onkeyup='" + strComboBoxName + ".txt_OnKeyUp()' " +
  33.                        " style='display: none; position: absolute' value='' >";
  34.  
  35.     this.Mycmb.insertAdjacentHTML("afterEnd", strMytxt);
  36.     //assign obj to new textbox
  37.     this.Mytxt = document.all[strMytxtID];
  38.  
  39.     var strMyHiddentxtID = strDropDownListID + "_value";
  40.     
  41.     var strMyHiddentxt = "<INPUT type='hidden' " + " id=" + strMyHiddentxtID + " name=" + strMyHiddentxtID + " >";
  42.  
  43.     this.Mycmb.insertAdjacentHTML("afterEnd", strMyHiddentxt);
  44.     this.MyHiddentxt = document.all[strMyHiddentxtID];
  45.  
  46.     this.AdjustingSize = false;
  47.     this.AlignTextBoxOverDropDown();
  48.  
  49.     comboBoxArray[comboBoxArray.length] = this;
  50. }
  51.  
  52. function SetAccessKey(Key)
  53. {
  54.     this.Mytxt.accessKey = Key;
  55. }
  56.  
  57. function CreateIPComboBoxObject(strDropDownListID, strComboBoxName)
  58. {
  59.     this.MyIPcmb = document.all[strDropDownListID];
  60.     this.MyIPcmb.selectedIndex        = -1;
  61.     this.UseStateFunctions        = false;
  62.     this.AlignIPCombo    = AlignIPCombo;
  63.     this.cboIP_OnChange                = cboIP_OnChange;
  64.     this.cboIPRange_OnChange                = cboIPRange_OnChange;
  65.     this.UseStateFunctions = false;
  66.     this.AdjustingSize = false;
  67.     this.IPAddressArrowUp = IPAddressArrowUp;
  68.     this.IPAddressArrowDown = IPAddressArrowDown;
  69.     this.IPRangeAddressArrowUp = IPRangeAddressArrowUp;
  70.     this.IPRangeAddressArrowDown = IPRangeAddressArrowDown;
  71.     this.AlignIPCombo();
  72.  
  73.     IPcomboBoxArray[IPcomboBoxArray.length] = this;
  74. }
  75.  
  76. function CreateSUSComboBoxObject(strDropDownListID, strComboBoxName)
  77. {
  78.     this.MySUScmb = document.all[strDropDownListID];
  79.     this.MySUScmb.selectedIndex        = -1;
  80.     this.AlignSUSTextBoxOverDropDown    = AlignSUSTextBoxOverDropDown;
  81.     this.GetSUSSelectedText            = GetSUSSelectedText;
  82.     this.cboSUS_OnChange                = cboSUS_OnChange;
  83.     this.DisableSUS = DisableSUS;
  84.     this.EnableSUS = EnableSUS;
  85.     this.AdjustingSize = false;
  86.     this.SetDefaultSUSText            = SetDefaultSUSText;
  87.     var strMytxtID = "txtMytxt" + strDropDownListID;
  88.     var strMytxt = "<INPUT type='text' id=" + strMytxtID + " name=" + strMytxtID + " style='display: none; position: absolute' value='' >";
  89.     this.MySUScmb.insertAdjacentHTML("afterEnd", strMytxt);
  90.     //assign obj to new textbox
  91.     this.MySUStxt = document.all[strMytxtID];
  92.  
  93.     this.AlignSUSTextBoxOverDropDown();
  94.     SUScomboBoxArray[SUScomboBoxArray.length] = this;
  95. }
  96.  
  97. function SetDefaultSUSText(Text)
  98. {
  99.     this.MySUScmb.selectedIndex = -1;
  100.     this.MySUStxt.value = Text;
  101. }
  102.  
  103. function DisableSUS()
  104. {
  105.     this.MySUScmb.disabled = true;
  106.     this.MySUStxt.disabled = true;
  107. }
  108.  
  109. function EnableSUS()
  110. {
  111.     this.MySUScmb.disabled = false;
  112.     this.MySUStxt.disabled = false;
  113. }
  114.  
  115. function AlignIPCombos()
  116. {
  117.     var iIndex;
  118.     for (iIndex=0; iIndex < comboBoxArray.length; iIndex++)
  119.     {
  120.         IPcomboBoxArray[iIndex].AlignIPCombo();
  121.     }
  122. }
  123.  
  124. function AlignIPCombo()
  125. {    
  126.     if (!this.AdjustingSize)
  127.     {
  128.         this.AdjustingSize = true;
  129.         this.MyIPcmb.style.position="static";
  130.  
  131.         this.MyIPcmb.style.position    ="absolute";
  132.         this.MyIPcmb.style.posLeft    = GetAbsoluteXPosition(document.getElementById("IP1"))
  133.         this.MyIPcmb.style.posTop    = GetAbsoluteYPosition(document.getElementById("IP1"));
  134.         
  135.         if(document.all["IP1"].clientWidth >29)
  136.         {    
  137.             if(document.all["IP5"] != null && document.all["IP5"] != 'undefined')
  138.             {//must be an IP Range
  139.                 this.MyIPcmb.style.width = "405px";
  140.             }
  141.             else
  142.             {//single IP
  143.                 this.MyIPcmb.style.width = "190px";
  144.             }
  145.             var strClipRectangle = "rect(0 " + 
  146.                             (this.MyIPcmb.offsetWidth) + " " +
  147.                             this.MyIPcmb.offsetHeight + " " +
  148.                         (this.MyIPcmb.offsetWidth - 20) + ")";
  149.         }
  150.         else
  151.         {
  152.         var strClipRectangle = "rect(0 " + 
  153.                             (this.MyIPcmb.offsetWidth) + " " +
  154.                             this.MyIPcmb.offsetHeight + " " +
  155.                             (this.MyIPcmb.offsetWidth - 18 ) + ")";
  156.         }
  157.         this.MyIPcmb.style.clip = strClipRectangle;
  158.         this.AdjustingSize = false;
  159.     }
  160. }
  161.  
  162. function AlignTextBoxesOverDropDowns()
  163. {
  164.     var iIndex;
  165.     for (iIndex=0; iIndex < comboBoxArray.length; iIndex++)
  166.     {
  167.         comboBoxArray[iIndex].AlignTextBoxOverDropDown();
  168.     }
  169. }
  170.  
  171. //sets the default option
  172. function SetDefaultText(Text)
  173. {
  174.  
  175.     this.Mycmb.selectedIndex = -1;
  176.     this.Mytxt.value = Text;
  177. }
  178.  
  179.  
  180. //Move the textbox over the Combo
  181. function AlignTextBoxOverDropDown()
  182. {    
  183.     if (!this.AdjustingSize)
  184.     {
  185.         this.AdjustingSize = true;
  186.         this.Mytxt.style.display="none";
  187.         this.Mycmb.style.position="static";
  188.  
  189.         this.Mytxt.style.posLeft    = GetAbsoluteXPosition(this.Mycmb);
  190.         this.Mytxt.style.posTop        = GetAbsoluteYPosition(this.Mycmb) + 1;
  191.         this.Mytxt.style.posWidth    = this.Mycmb.offsetWidth - 16;  // 16 THIS IS THE WIDTH OF THE DROP DOWN ARROW
  192.         this.Mytxt.style.posHeight    = this.Mycmb.offsetHeight;
  193.  
  194.         this.Mycmb.style.position    ="absolute";
  195.         this.Mycmb.style.posLeft    = this.Mytxt.style.posLeft;
  196.         this.Mycmb.style.posTop    = this.Mytxt.style.posTop;
  197.         
  198.         this.ComboWidth = this.Mycmb.offsetWidth;
  199.         var strClipRectangle = "rect(0 " + 
  200.                             (this.Mycmb.offsetWidth) + " " +
  201.                             this.Mycmb.offsetHeight + " " +
  202.                             (this.Mytxt.style.posWidth -5 ) + ")";
  203.  
  204.         this.Mycmb.style.clip = strClipRectangle;
  205.         this.Mytxt.style.display="";
  206.         this.AdjustingSize = false;
  207.     }
  208.  
  209. }
  210.  
  211. function AlignSUSTextBoxOverDropDown()
  212. {    
  213.     if (!this.AdjustingSize)
  214.     {
  215.         this.AdjustingSize = true;
  216.         this.MySUStxt.style.display="none";
  217.         this.MySUScmb.style.position="static";
  218.  
  219.         this.MySUStxt.style.posLeft    = GetAbsoluteXPosition(this.MySUScmb);
  220.         this.MySUStxt.style.posTop        = GetAbsoluteYPosition(this.MySUScmb) + 1;
  221.         this.MySUStxt.style.posWidth    = this.MySUScmb.offsetWidth - 16;  // 16 THIS IS THE WIDTH OF THE DROP DOWN ARROW
  222.         this.MySUStxt.style.posHeight    = this.MySUScmb.offsetHeight;
  223.  
  224.         this.MySUScmb.style.position    ="absolute";
  225.         this.MySUScmb.style.posLeft    = this.MySUStxt.style.posLeft;
  226.         this.MySUScmb.style.posTop    = this.MySUStxt.style.posTop;
  227.         
  228.         this.ComboWidth = this.MySUScmb.offsetWidth;
  229.         var strClipRectangle = "rect(0 " + 
  230.                             (this.MySUScmb.offsetWidth) + " " +
  231.                             this.MySUScmb.offsetHeight + " " +
  232.                             (this.MySUStxt.style.posWidth -5 ) + ")";
  233.  
  234.         this.MySUScmb.style.clip = strClipRectangle;
  235.         this.MySUStxt.style.display="";
  236.         this.AdjustingSize = false;
  237.     }
  238.  
  239. }
  240. function Clear()
  241. {
  242.     this.Mytxt.value = "";
  243.     this.Mycmb.selectedIndex = -1;
  244. }
  245.  
  246. function GetAbsoluteXPosition(element)
  247. {
  248.     var pos = 0;
  249.     while (element != null)
  250.     {
  251.         pos += element.offsetLeft;
  252.         element = element.offsetParent;
  253.     }
  254.  
  255.     return pos;
  256. }
  257.  
  258. function GetAbsoluteYPosition(element)
  259. {
  260.     var pos = 0;
  261.  
  262.     while (element != null )
  263.     {
  264.         pos += element.offsetTop;
  265.         element = element.offsetParent;
  266.     }
  267.  
  268.     return pos;
  269. }
  270. function GetSUSSelectedText()
  271. {
  272.     return this.MySUStxt.value;
  273. }
  274.  
  275. function GetSelectedText()
  276. {
  277.     return this.Mytxt.value;
  278. }
  279.  
  280. function cboIP_OnChange()
  281. {
  282.     var tmpIndex = this.MyIPcmb.selectedIndex;
  283.     var tempOption = this.MyIPcmb.options[tmpIndex];
  284.     
  285.     var IPArr = tempOption.text.split(".")
  286.     document.all["IP1"].value = IPArr["0"];
  287.     document.all["IP2"].value = IPArr["1"];
  288.     document.all["IP3"].value = IPArr["2"];
  289.     document.all["IP4"].value = IPArr["3"];
  290.     
  291.     this.MyIPcmb.selectedIndex=-1;
  292.     if(this.UseStateFunctions) 
  293.     {
  294.         SetState("IP");
  295.     }
  296. }
  297.  
  298. function cboIPRange_OnChange()
  299. {
  300.     var tmpIndex = this.MyIPcmb.selectedIndex;
  301.     var tempOption = this.MyIPcmb.options[tmpIndex];
  302.  
  303.     var IPArr = tempOption.text.split("to")
  304.     var IP1 = IPArr["0"].split(".");
  305.     var IP2 = IPArr["1"].split(".");
  306.     
  307.     document.all["IP1"].value = IP1["0"];
  308.     document.all["IP2"].value = IP1["1"];
  309.     document.all["IP3"].value = IP1["2"];
  310.     document.all["IP4"].value = IP1["3"].substring(0,IP1["3"].length-1);
  311.     document.all["IP5"].value = IP2["0"].substring(1,IP2["0"].length);
  312.     document.all["IP6"].value = IP2["1"];
  313.     document.all["IP7"].value = IP2["2"];
  314.     document.all["IP8"].value = IP2["3"];
  315.     
  316.     if(this.UseStateFunctions) 
  317.     {
  318.         SetState("IP");
  319.     }
  320.     this.MyIPcmb.selectedIndex=-1;
  321. }
  322.  
  323. function cbo_OnChange()
  324. {
  325.     var tmpIndex = this.Mycmb.selectedIndex;
  326.     var tempOption = this.Mycmb.options[tmpIndex];
  327.     this.Mytxt.value  = tempOption.text;
  328.     
  329.     this.Mytxt.focus();
  330.     this.Mytxt.select();
  331.     
  332.     if(this.UseStateFunctions) 
  333.     {
  334.         SetState("CPU");
  335.     }
  336.     this.Mycmb.selectedIndex=-1;
  337. }
  338.  
  339. function cboSUS_OnChange()
  340. {
  341.     
  342.     var tmpIndex = this.MySUScmb.selectedIndex;
  343.     var tempOption = this.MySUScmb.options[tmpIndex];
  344.     
  345.     this.MySUStxt.value  = tempOption.text;
  346.     
  347.     this.MySUStxt.focus();
  348.     this.MySUStxt.select();
  349.     
  350.     this.MySUScmb.selectedIndex=-1;
  351. }
  352.  
  353. function txt_OnKeyUp()
  354. {        
  355.     if (this.LookupValues)
  356.     {
  357.         if (event.keyCode < 32)  
  358.         {
  359.             return;
  360.         }
  361.         else if (event.keyCode == 46)  
  362.         {
  363.             return;
  364.         }
  365.         else if (event.keyCode == 38)//up arrow  
  366.         {
  367.             var len = this.Mycmb.options.length;
  368.             if(len > 0)
  369.             {
  370.                 var tempString;
  371.                 var curText        = this.Mytxt.value;
  372.                 var FoundIndex = -1;
  373.                 for (var iIndex=0; iIndex<len; iIndex++)
  374.                 {
  375.                     tempString = this.Mycmb.options(iIndex).text;
  376.                     
  377.                     tempString = tempString.toUpperCase();
  378.                     curText = curText.toUpperCase();
  379.                     if (tempString == curText)
  380.                     {
  381.                         FoundIndex = iIndex;
  382.                     }
  383.                 }
  384.                 if(FoundIndex == -1)
  385.                 {
  386.                     //do nothing
  387.                 }
  388.                 else
  389.                 {
  390.                     if(FoundIndex > 0)
  391.                     {
  392.                         this.Mytxt.value = this.Mycmb.options(FoundIndex -1).text;
  393.                         var tmpRange = this.Mytxt.createTextRange();
  394.                         tmpRange.moveStart("character", this.Mytxt.length);
  395.                         tmpRange.select();
  396.                         SetState("CPU");
  397.                     }
  398.                 }
  399.             }            
  400.             return;
  401.         }
  402.         else if (event.keyCode == 40)//Down arrow  
  403.         {
  404.             var len = this.Mycmb.options.length;
  405.             if(len > 0)
  406.             {
  407.                 var tempString;
  408.                 var curText        = this.Mytxt.value;
  409.                 var FoundIndex = -1;
  410.             
  411.                 for (var iIndex=0; iIndex<len; iIndex++)
  412.                 {
  413.                     
  414.                     tempString = this.Mycmb.options(iIndex).text;    
  415.                     tempString = tempString.toUpperCase();
  416.                     curText = curText.toUpperCase();
  417.                     if (tempString == curText)
  418.                     {
  419.                         FoundIndex = iIndex;
  420.                     }
  421.                 }
  422.                 if(FoundIndex == -1)
  423.                 {
  424.                     this.Mytxt.value = this.Mycmb.options(0).text;
  425.                     var tmpRange = this.Mytxt.createTextRange();
  426.                     tmpRange.moveStart("character", this.Mytxt.length);
  427.                     tmpRange.select();
  428.                     SetState("CPU");
  429.                 }
  430.                 else
  431.                 {    
  432.                     if(FoundIndex < this.Mycmb.options.length - 1)
  433.                     {
  434.                         this.Mytxt.value = this.Mycmb.options(FoundIndex + 1).text;
  435.                         var tmpRange = this.Mytxt.createTextRange();
  436.                         tmpRange.moveStart("character", this.Mytxt.length);
  437.                         tmpRange.select();
  438.                         SetState("CPU");
  439.                     }
  440.                 }
  441.             }
  442.             return;
  443.         }
  444.         if(this.UseStateFunctions) 
  445.         {
  446.             SetState("CPU");
  447.         }
  448.         var curText        = this.Mytxt.value;
  449.         var prevText    = this.MytxtPreviousValue;
  450.         var iIndex;
  451.  
  452.         if ((curText == "")    || (curText == prevText))
  453.         {
  454.             this.MytxtPreviousValue = curText;
  455.             return;
  456.         }
  457.  
  458.         var len = this.Mycmb.options.length;
  459.         var tempString;
  460.         
  461.         for (iIndex=0; iIndex<len; iIndex++)
  462.         {
  463.             tempString = this.Mycmb.options(iIndex).text;
  464.  
  465.             if (this.LookupCaseInSensitive)
  466.             {
  467.                 tempString = tempString.toUpperCase();
  468.                 curText = curText.toUpperCase();
  469.             }
  470.  
  471.             if (tempString.indexOf(curText) == 0)
  472.             {
  473.                 var helperString = this.Mycmb.options(iIndex).text;
  474.  
  475.                 this.Mytxt.value = this.Mytxt.value + helperString.substr(curText.length);
  476.                 this.Mycmb.selectedIndex = iIndex;
  477.                 this.MytxtPreviousValue = this.Mytxt.value;
  478.  
  479.                 var tmpRange = this.Mytxt.createTextRange();
  480.                 tmpRange.moveStart("character", curText.length);
  481.                 tmpRange.select();
  482.                 return;
  483.             }
  484.         }
  485.     }
  486. }
  487.  
  488. function txt_OnBlur()
  489. {
  490.     var myDropDownList    = this.Mycmb;
  491.     var myEditCell        = this.Mytxt;
  492.     var myHiddenCell    = this.MyHiddentxt;
  493.     var iIndex;
  494.     
  495.     myHiddenCell.value = myEditCell.value;
  496.     myDropDownList.selectedIndex = -1;
  497.  
  498.     if (myEditCell.value == "")
  499.     {
  500.         return;
  501.     }
  502.  
  503.     var len = myDropDownList.options.length;
  504.     for (iIndex=0; iIndex<len; iIndex++)
  505.     {
  506.         var str1 = myDropDownList.options(iIndex).text;
  507.         var str2 = myEditCell.value;
  508.  
  509.         if (this.LookupCaseInSensitive)
  510.         {
  511.             str1 = str1.toUpperCase();
  512.             str2 = str2.toUpperCase();
  513.         }
  514.         
  515.         if (str1 == str2)
  516.         {
  517.             myDropDownList.selectedIndex = iIndex;
  518.             myHiddenCell.value = myDropDownList.options(iIndex).value;
  519.             return;
  520.         }
  521.     }
  522.  
  523.     if (this._bOnlyAllowedEntries)
  524.     {
  525.         myDropDownList.focus();    
  526.  
  527.         alert("'" + myEditCell.value + "' is not allowed");
  528.         this.Mycmb.selectedIndex = -1;
  529.         this.Mytxt.select();
  530.         
  531.         return;
  532.     }
  533. }
  534.  
  535. function focus()
  536. {
  537.     this.Mycmb.focus();
  538. }
  539.  
  540. function setDefaultIndex(iIndex)
  541. {
  542.     var len = this.Mycmb.options.length;
  543.     if ((iIndex >=0) && (iIndex < len))
  544.     {
  545.         this.Mycmb.selectedIndex = iIndex;
  546.         this.Mytxt.value = this.Mycmb.options(iIndex).text;
  547.         this.MyHiddentxt.value = this.Mycmb.options(iIndex).value;
  548.         return;
  549.     }
  550.  
  551.     this.Mytxt.value = "";
  552. }
  553.  
  554. function IPAddressArrowUp(curText)
  555. {
  556.     var len = this.MyIPcmb.options.length;
  557.     if(len > 0)
  558.     {
  559.         var tempString;
  560.         var FoundIndex = -1;
  561.         var NewValue = "";
  562.         for (var iIndex=0; iIndex<len; iIndex++)
  563.         {
  564.             tempString = this.MyIPcmb.options(iIndex).text;
  565.             if (tempString.toString() == curText.toString())
  566.             {
  567.                 FoundIndex = iIndex;
  568.             }
  569.         }
  570.         if(FoundIndex == -1)
  571.         {
  572.             //do nothing
  573.             NewValue = curText;
  574.         }
  575.         else
  576.         {
  577.             if(FoundIndex > 0)
  578.             {
  579.                 NewValue = this.MyIPcmb.options(FoundIndex -1).text;
  580.             }
  581.         }
  582.         return NewValue;
  583.     }
  584.     else
  585.         return "";
  586. }
  587. function IPAddressArrowDown(curText)
  588. {
  589.     var len = this.MyIPcmb.options.length;
  590.     if(len > 0)
  591.     {
  592.         var tempString;
  593.         var NewValue = "";
  594.         var FoundIndex = -1;
  595.         for (var iIndex=0; iIndex<len; iIndex++)
  596.         {
  597.             tempString = this.MyIPcmb.options(iIndex).text;
  598.  
  599.             if (tempString.toString() == curText.toString())
  600.             {
  601.                 FoundIndex = iIndex;
  602.             }
  603.         }
  604.         if(FoundIndex == -1)
  605.         {
  606.             NewValue = this.MyIPcmb.options(0).text;
  607.         }
  608.         else
  609.         {
  610.             if(FoundIndex < this.MyIPcmb.options.length - 1)
  611.             {
  612.                 NewValue = this.MyIPcmb.options(FoundIndex + 1).text;
  613.             }
  614.         }
  615.  
  616.         return NewValue;
  617.     }
  618.     else
  619.         return "";
  620. }
  621.  
  622. function IPRangeAddressArrowUp(curText)
  623. {
  624.     var len = this.MyIPcmb.options.length;
  625.     
  626.     if(len > 0)
  627.     {
  628.         var curIPArr = curText.split("to");
  629.         var curIP1 = curIPArr["0"].substring(0,curIPArr["0"].length -1);
  630.         var curIP2 = curIPArr["1"].substring(1,curIPArr["1"].length -1);
  631.     
  632.         var tempString;
  633.         var FoundIndex = -1;
  634.         var NewValue = "";
  635.         for (var iIndex=0; iIndex<len; iIndex++)
  636.         {
  637.             tempString = this.MyIPcmb.options(iIndex).text;
  638.             
  639.             var IPArr = tempString.split("to");
  640.             var IP1 = IPArr["0"].substring(0,IPArr["0"].length -1);
  641.             var IP2 = IPArr["1"].substring(1,IPArr["1"].length -1);
  642.             if (curIP1.toString() == IP1.toString() && curIP2.toString() == IP2.toString())
  643.             {
  644.                 FoundIndex = iIndex;
  645.             }
  646.         }
  647.         if(FoundIndex == -1)
  648.         {
  649.             //do nothing
  650.             NewValue = curText;
  651.         }
  652.         else
  653.         {
  654.             if(FoundIndex > 0)
  655.             {
  656.                 NewValue = this.MyIPcmb.options(FoundIndex -1).text;
  657.             }
  658.         }
  659.         return NewValue;
  660.     }
  661.     else
  662.         return "";
  663. }
  664.  
  665. function IPRangeAddressArrowDown(curText)
  666. {
  667.     var len = this.MyIPcmb.options.length;
  668.     
  669.     if(len > 0)
  670.     {
  671.         var curIPArr = curText.split("to");
  672.         var curIP1 = curIPArr["0"].substring(0,curIPArr["0"].length -1);
  673.         var curIP2 = curIPArr["1"].substring(1,curIPArr["1"].length -1);
  674.     
  675.         var tempString;
  676.         var FoundIndex = -1;
  677.         var NewValue = "";
  678.         for (var iIndex=0; iIndex<len; iIndex++)
  679.         {
  680.             tempString = this.MyIPcmb.options(iIndex).text;
  681.             
  682.             var IPArr = tempString.split("to");
  683.             var IP1 = IPArr["0"].substring(0,IPArr["0"].length -1);
  684.             var IP2 = IPArr["1"].substring(1,IPArr["1"].length -1);
  685.             if (curIP1.toString() == IP1.toString() && curIP2.toString() == IP2.toString())
  686.             {
  687.                 FoundIndex = iIndex;
  688.             }
  689.         }
  690.         if(FoundIndex == -1)
  691.         {
  692.             //do nothing
  693.             NewValue = curText;
  694.         }
  695.         else
  696.         {
  697.             if(FoundIndex < this.MyIPcmb.options.length - 1)
  698.             {
  699.                 NewValue = this.MyIPcmb.options(FoundIndex + 1).text;
  700.             }
  701.         }
  702.         return NewValue;
  703.     }
  704.     else
  705.         return "";
  706.     
  707. }
  708.